package com.baosight.sczx.zm.ca.service;

import com.baosight.iplat4j.core.ei.EiConstant;
import com.baosight.iplat4j.core.ei.EiInfo;
import com.baosight.iplat4j.core.threadlocal.UserSession;
import com.baosight.iplat4j.ep.ServiceEPBase;
import com.baosight.sczx.common.zm.basetools.StaticTools;
import com.baosight.sczx.common.zm.cInterface.User;
import com.baosight.sczx.zm.ca.domain.ZMCA4500;

public class ServiceZMCA50 extends ServiceEPBase{

	public EiInfo initLoad(EiInfo info)
	{    
		info.addBlock(EiConstant.resultBlock).set("showCount", "true");//如果不加这个，翻页的统计和显示是错误的
		return query(info);
	}
	
	@SuppressWarnings("unused")
	private void addCondition(EiInfo inInfo) {
		if(inInfo.getBlock("queryBlock")!=null){
			String fdProblemTypeId = inInfo.getBlock("queryBlock").getCellStr(0, "fdProblemTypeId"); 
			String fdCheckPersonId = inInfo.getBlock("queryBlock").getCellStr(0, "fdCheckPersonId"); 
			String fdCheckTime = inInfo.getBlock("queryBlock").getCellStr(0, "fdCheckTime");
			String fdCheckContent = inInfo.getBlock("queryBlock").getCellStr(0, "fdCheckContent");
			
			StaticTools.setQueryParameters(inInfo, "fdProblemTypeId", fdProblemTypeId, true);
			StaticTools.setQueryParameters(inInfo, "fdCheckPersonId", fdCheckPersonId, true);
			StaticTools.setQueryParameters(inInfo, "fdCheckTime", fdCheckTime, true);
			StaticTools.setQueryParameters(inInfo, "fdCheckContent", fdCheckContent, true);
			}
		return;
	}
	
	public EiInfo query(EiInfo info)
	{
//		StaticTools.setQueryParameters(info, "fdCheckpersonId", UserSession.getLoginName().toString().trim(), true);
		EiInfo outInfo = super.query(info,"ZMCA4500.query",new ZMCA4500());
		outInfo.addBlock( (new ServiceZMCA42()).initTypeBlockCombobox());
		outInfo.addBlock(User.getInstance().getConstructionStaff("cmes.cp.people", "empCode", "empName", true));
		return outInfo;
	}
	
	public EiInfo initQuery(EiInfo info)
	{
		StaticTools.setQueryParameters(info, "fdCheckpersonId", UserSession.getLoginName(), true);
		EiInfo outInfo = super.query(info,"ZMCA4500.query",new ZMCA4500());	
		outInfo.addBlock( (new ServiceZMCA42()).initTypeBlockCombobox());
		outInfo.addBlock(User.getInstance().getConstructionStaff("cmes.cp.people", "empCode", "empName", true));
		return outInfo;
	}
}
